#! /usr/bin/env python
# -*- coding: utf-8 -*-


class HeapHashException(Exception): pass


class HeapNode:
    def __init__(self, heap_val, left=None, right=None, parent=None):
        self.val = heap_val
        self.left, self.right = left, right
        self.parent = parent


class HeapValue:
    def __init__(self, key, value=None):
        self.key = key              # 反向索引到hash中
        self.value = value

    def __cmp__(self, other):
        return self.value < other.value


class Heap:
    def __init__(self, root=None):
        self.root = root

    def update(self, node, value):
        # 直接更新heap中某个节点的值, 并调整node在heap中位置
        pass

    def pop(self,):
        pass

    def push(self, node):
        pass

    def replace(self,):
        pass


class HashHeap:
    def __init__(self):
        self.hash = {}              # key, node
        self.heap = Heap()          #

    def put(self, heap_value):
        pass

    def update(self, node, heap_val):
        pass

    def pop(self,):
        pass
